package rss.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class FunzioniUtilita {

	static String formatoDataHHmm="dd/MM/yyyy HH:mm";

	public static String formatDateHHmm(Date data) {
		SimpleDateFormat df = new SimpleDateFormat(formatoDataHHmm);
		df.setTimeZone(TimeZone.getDefault());
		return  df.format(data);
	}

	public static String getLocalDateFromGMT(Date dataGMT)
	{
		
		String dataGTMStr=formatDateHHmm(dataGMT)+" GMT";
		SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm Z");		
		sdf.setTimeZone(TimeZone.getDefault());
		
		String ret=null;
		try {
			ret=formatDateHHmm(sdf.parse(dataGTMStr));
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return ret;
	}
}
